package com.javakc.pms.order.dispord.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

@Getter
@Setter
@Entity
@Table(name = "pms_order_library")
@EntityListeners(AuditingEntityListener.class)
public class DispOrd {
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    /**
     * 优先级
     */
    @NotNull(message = "优先级不能为空")
    private Integer priority;
    /**
     * 专业类型
     */
    @NotNull(message = "专业类型不能为空")
    private Integer orderType;
    /**
     * 指令名称
     */
    @NotBlank(message = "指令名称不能为空")
    @Length(min = 2,max = 60,message = "指令名称要在{min}-{max}之间")
    private String orderName;
    /**
     * 指令描述
     */
    @NotBlank(message = "指令描述不能为空")
    @Length(min = 2,max = 60,message = "指令描述长度要在{min}-{max}之间")
    private String orderDescribe;
    /**
     * 删除状态
     */
    private Integer deleteFlag;
    /**
     * 创建人
     */
    private String createdBy;
    /**
     * 创建时间
     */
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Column(name = "created_time",updatable = false)
    private Date createdTime;
    /**
     * 更新人
     */
    private String updatedBy;
    /**
     * 更新时间
     */
    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Column(name = "updated_time",insertable = false)
    private Date updatedTime;
}
